Mark J. Kilgard
Silicon Graphics Inc.
Welcome to the ``OpenGL and X'' column. This column is the outgrowth of my three-part series on programming OpenGL with the X Window System. The purpose of the column is to continue explaining how to put interactive 3D graphics into your X programs.
In the past year, there's been remarkable progress adopting OpenGL as the premier Application Programming Interface (API) for interactive 3D graphics. Major workstation vendors are supplying OpenGL for their X workstations: Digital, IBM, and Silicon Graphics. Independent software vendors (ISVs) have or are readying ports of OpenGL for Sun and Hewlett-Packard workstations. And OpenGL is not limited to the X world. OpenGL is also supported in a new version of IBM's OS/2 and in Microsoft's Windows NT 3.5 (code named Daytona). A very exciting development is the announcement of custom graphics chips designed specifically for OpenGL rendering. These chips, like the GLint chip from 3Dlabs, promise to make OpenGL graphics inexpensive and accessible.
These developments point the way for OpenGL to be the catalyst that brings interactive 3D graphics into the computing mainstream. The past decade has shown that it takes a technically mature software interface with broad-based support to launch new computer technologies. For example, PostScript has changed the way we all think about computer generated hardcopy. And the TCP/IP networking protocols have opened the Internet to the world. PostScript and TCP/IP didn't invent laser printing or networking, but these two standards made possible the widespread adoption of the technologies they enabled. OpenGL will do the same for 3D graphics.
This column will assume some familiarity with OpenGL. For readers who need this background, I encourage you to read The X Journal back issues containing the original ``OpenGL and X'' series. Also you should be able to find The OpenGL Programming Guide and The OpenGL Reference Manual (often called the ``red'' and ``blue'' books respectively because of the color of their covers) in most computer literate bookstores.
Because OpenGL is window-system independent (the OpenGL API can work just as well for X as it does for Windows NT or OS/2), an OpenGL program uses the window management functions of its host window system. In the ``red'' book, OpenGL examples were presented using the AUX library. AUX is a window-system independent toolkit for using OpenGL. The AUX interface lets you open a single window, render OpenGL, and handle basic input, but that is about the extent of its functionality. It's good for examples but not appropriate for anything much more sophisticated.
Two alternatives to AUX are using Motif or Xlib to write your OpenGL applications. Either alternative works. In practice, Motif is likely to be the window system API most X programmers will use for sophisticated OpenGL applications. Unfortunately, both Motif and Xlib are rather complex. Many programmers wishing to explore 3D graphics with OpenGL will want something in between the toyish feel of AUX and the complexity of Motif or Xlib. That's where this issue's column helps out: supplying a reasonable toolkit to explore OpenGL. Future columns will use the described toolkit to demonstrate specific OpenGL functionality like lighting and texturing.
The toolkit I describe is named GLUT, short for the openGL
Utility Toolkit. The API for GLUT is designed to
be simple and straightforward. Unlike more complex APIs like Xlib
or Motif, very little setup is needed to begin displaying graphics.
Also the GLUT API avoids obvious window system dependencies. The intent is
that a GLUT program could be recompiled for OS/2 or NT if a GLUT
implementation for those window systems was available. An implementation
of GLUT for X is available through the Internet.
So what does GLUT do for you? GLUT supports the following functionality:
GLUT does have limitations and isn't suitable for every purpose, but I think you'll find it a reasonable vehicle to explore 3D graphics using OpenGL without getting bogged down in writing X or Motif code. 3D should be fun; not a chore.